﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;

namespace V5_Common.FrameWork {
    public class BaseToolsHelper {
        private static readonly BaseToolsHelper m_Instance = new BaseToolsHelper();
        /// <summary>
        /// 
        /// </summary>
        public static BaseToolsHelper Instance {
            get { return m_Instance; }
        }
        /// <summary>
        /// 加载样式
        /// </summary>
        /// <param name="p"></param>
        /// <param name="cssPath"></param>
        /// <returns></returns>
        public string Css(Page p, string cssPath) {
            string c = p.ResolveUrl("~/") + cssPath;
            return @"<link href=""" + c + @""" rel=""stylesheet"" type=""text/css"" />";
        }
        /// <summary>
        /// 加载样式
        /// </summary>
        /// <param name="p"></param>
        /// <param name="cssPath"></param>
        /// <returns></returns>
        public string Css(UserControl p, string cssPath) {
            string c = p.ResolveUrl("~/") + cssPath;
            return @"<link href=""" + c + @""" rel=""stylesheet"" type=""text/css"" />";
        }
        /// <summary>
        /// 加载脚本
        /// </summary>
        /// <param name="p"></param>
        /// <param name="jsPath"></param>
        /// <returns></returns>
        public string Script(Page p, string jsPath) {
            string c = p.ResolveUrl("~/") + jsPath;
            return @"<script src=""" + c + @""" type=""text/javascript""></script>";
        }
        /// <summary>
        /// 加载脚本
        /// </summary>
        /// <param name="p"></param>
        /// <param name="jsPath"></param>
        /// <returns></returns>
        public string Script(UserControl p, string jsPath) {
            string c = p.ResolveUrl("~/") + jsPath;
            return @"<script src=""" + c + @""" type=""text/javascript""></script>";
        }
    }
}
